package com.zycfc.zsf.boot.mybatis.typehandler;

import org.apache.ibatis.type.*;
import java.util.*;
import org.springframework.util.*;
import java.sql.*;

public class IntegerAscArrayTypeHandler extends IntegerArrayTypeHandler
{
    private final String delimiter;
    
    public IntegerAscArrayTypeHandler() {
        this.delimiter = ",";
    }
    
    public IntegerAscArrayTypeHandler(final String delimiter) {
        this.delimiter = delimiter;
    }
    
    @Override
    public void setNonNullParameter(final PreparedStatement ps, final int i, final Integer[] parameter, final JdbcType jdbcType) throws SQLException {
        Arrays.sort(parameter);
        ps.setString(i, StringUtils.arrayToDelimitedString((Object[])parameter, this.delimiter));
    }
}
